//
//  wantMakeMoneyViewController.m
//  FastRunDemo
//
//  Created by 苟亚明 on 16/9/22.
//  Copyright © 2016年 苟亚明. All rights reserved.
//

#import "wantMakeMoneyViewController.h"
#import "submitFooterView.h"
#import "wantMakeMoneyCell.h"
@interface wantMakeMoneyViewController () <UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) NSArray *arrayData;
@property (nonatomic, strong)UITableView *tableView;
@end

@implementation wantMakeMoneyViewController

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    UIImage *image = [UIImage imageNamed:@"transparent-1"];
    [self.navigationController.navigationBar setBackgroundImage:image
                                                  forBarMetrics:UIBarMetricsDefault];
    [self.navigationController.navigationBar setShadowImage:image];
    
}
static NSString *const makeMoneyCellId = @"makeMoneyCellId";
- (void)viewDidLoad {
    [super viewDidLoad];
    self.arrayData = @[@"全部",@"帮你买",@"带饭",@"拿快递",@"电脑维修",@"你懂的",@"物品求租",@"学习帮辅",@"洗衣服"];
    
//    self.automaticallyAdjustsScrollViewInsets = NO;
    self.tableView = [[UITableView alloc]initWithFrame:self.view.bounds];
    submitFooterView *footer = [[[NSBundle mainBundle]loadNibNamed:@"submitFooterView" owner:nil options:nil]lastObject];
    [self.tableView registerNib:[UINib nibWithNibName:@"wantMakeMoneyCell" bundle:nil] forCellReuseIdentifier:makeMoneyCellId];
    footer.height = 44;
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.tableFooterView = footer;
    
    
    self.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithImage:@"arrow_back" highImage:@"arrow_back" target:self action:@selector(leftBtnClick)];
    [self.view addSubview:self.tableView];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.arrayData.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    wantMakeMoneyCell *cell = [tableView dequeueReusableCellWithIdentifier:makeMoneyCellId];
    cell.lblTitle.text = self.arrayData[indexPath.row];
    return cell;
}

- (void)leftBtnClick{
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)viewDidDisappear:(BOOL)animated{
    [super viewDidDisappear:animated];
    [self.navigationController.navigationBar setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];
    [self.navigationController.navigationBar setShadowImage:nil];
}



@end
